import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 授课管理信息 */
export interface Teaching {
          id: number; // 授课管理主键
          commodityName: string; // 商品课程名称
          groupName: string; // 课程组名称
          teacherName: string; // 老师名称
          studentQuantity: number; // 报名学生人数
          remainderCourseTime: number; // 剩余课时
          allCourseTime: number; // 课程总课时
          commodityStatus: string; // 课程状态
  }

// 授课管理 API
export const TeachingApi = {
  // 查询授课管理分页
  getTeachingPage: async (params: any) => {
    return await request.get({ url: `/train/teaching/page`, params })
  },

  // 查询授课管理详情
  getTeaching: async (id: number) => {
    return await request.get({ url: `/train/teaching/get?id=` + id })
  },

  // 新增授课管理
  createTeaching: async (data: Teaching) => {
    return await request.post({ url: `/train/teaching/create`, data })
  },

  // 修改授课管理
  updateTeaching: async (data: Teaching) => {
    return await request.put({ url: `/train/teaching/update`, data })
  },

  // 删除授课管理
  deleteTeaching: async (id: number) => {
    return await request.delete({ url: `/train/teaching/delete?id=` + id })
  },

  /** 批量删除授课管理 */
  deleteTeachingList: async (ids: number[]) => {
    return await request.delete({ url: `/train/teaching/delete-list?ids=${ids.join(',')}` })
  },

  // 导出授课管理 Excel
  exportTeaching: async (params) => {
    return await request.download({ url: `/train/teaching/export-excel`, params })
  }
}